<template>
	<view class="page" style="">
		<nav-bar @selectSewlingLine="getSewingId"/>
	<view class="content">
		<view class="item" v-if="true || checkHasPermission('pda:inspection:getProductionRegistration')">
			<view class="img flex-center" style="background: #FFDED7;" @click.stop="toQulity">
				<image src="../../static/img/home/dengji.png"></image>
				<view class="hoem-title">{{ $t('home.quality') }}</view>
			</view>
		</view>
		<view v-if="true || checkHasPermission('pda:inspection:getRegistrationLog')" class="item">
			<view class="img flex-center" style="background: #FFFEDE;" @click.stop="toProductionRecord">
				<image src="../../static/img/home/jilu.png"></image>
				<view class="hoem-title">{{ $t('home.qualityRecord') }}</view>
			</view>
			<view class="img flex-center" style="background: #FFFEDE;" @click.stop="toCacheList">
				<image src="../../static/img/home/jilu.png"></image>
				<view class="hoem-title">{{ $t('home.cacheList') }}</view>
			</view>
		</view>
		<view class="item">
			<view v-if="true || checkHasPermission('pad:feeding:currentProduction')" class="img flex-center" style="background: #DCFFEB;" @click.stop="toExchange">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/huankuan.png"></image>
				<view style="text-align:center">{{$t('index.index.5q5i38ow0hk0')}}</view>
				</view>
			</view>
			<view v-if="true || checkHasPermission('pad:feeding:prepareFeeding')" class="img flex-center" style="background: #DCFFEB;" @click.stop="toFeeding">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/tiaozheng.png"></image>
				<view style="text-align:center">{{$t('index.index.5q5i38ow1u80')}}</view>
				</view>
			</view>
			<view v-if="true || checkHasPermission('pad:sewingchange:adjustProductionLine')" class="img flex-center" style="background: #DCFFEB;" @click.stop="toProductionAdjustment">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/icon-tiaozheng.png"></image>
				<view style="text-align:center">{{$t('index.index.5q5i38ow7e00')}}</view>
				</view>
			</view>
			<view v-if="true"  class="img flex-center" style="background: #DCFFEB;" @click.stop="toProductionAim">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/icon-tiaozheng.png"></image>
				<view style="text-align:center">{{$t('home.lineProductionAim')}}</view>
				</view>
			</view>
		</view>

		<view class="item">
			<view v-if="true" class="img flex-center" style="background: #72bbff3d;" @click.stop="toMaintance">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/maintance.png"></image>
				<view style="text-align:center">{{$t('home.deviceMaintenance')}}</view>
				</view>
			</view>

			<view v-if="true" class="img flex-center" style="background: #72bbff3d;" @click.stop="toDevicePrint">
				<view class="flex-cloumn-center">
				<image src="../../static/img/home/maintance.png"></image>
				<view style="text-align:center">设备打印</view>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	import storage from "@/utils/storage.js"
	import navBar from "@/components/nav/index.vue"
	export default {
		components: {
			navBar
		},
		data() {
			return {
				startingUpRateList: {},
				sewingName: this.$t('index.index.5q5i38owqgs0'),
				sewingId: '',
				value : this.$t('index.index.5q5i38owsgo0'),
			};
		},
		onLoad() {
			// plus.screen.unlockOrientation() //解除屏幕方向的锁定，但是不一定是竖屏
			// plus.screen.lockOrientation('landscape-primary') //锁定横屏
			// uni.createPushMessage({
			// 	title: '标题',
			// 	content: '内容',
			// 	icon: '图标路径',
			// 	success: function() {
			// 		console.log('推送消息发送成功');
			// 	},
			// 	fail: function(err) {
			// 		console.log('推送消息发送失败', err);
			// 	}
			// });
		},
		// onUnload() {
		// 	plus.screen.lockOrientation('portrait-primary'); 
		// },
		// onBackPress() {
		// 	//跳转到空白页
		// 	uni.redirectTo({
		// 		url:'/pages/quality/production/empty'
		// 	})
		// },
		methods: {
			// 获取缝制线id
			getSewingId(e) {
				this.sewingId = e
			},
			// 跳转质检页面
			toQulity() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId){
					
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/quality/index?sewingId=${this.sewingId}`
				})
			},
			// 跳转产量登记页面
			toProductionRecord() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId){
					
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/quality/production/productionRecord?sewingId=${this.sewingId}`
				})
			},
			// 产线换款
			toExchange() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId){
					
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/exchangeLine/index?sewingId=${this.sewingId}`
				})
			},
			// 跳转投料页面
			toFeeding() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId){
					
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/feeding/index?sewingId=${this.sewingId}`
				})
			},
			// 跳转产业调整
			toProductionAdjustment() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId){
					
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				// uni.navigateTo({
				// 	url: `/pages/quality/production/ProductionAdjustment?sewingId=${this.sewingId}`
				// })
					uni.navigateTo({
						url:`/pages/quality/production/toPortrait?sewingId=${this.sewingId}`
					})
			},
			// 跳转缓存列表
			toCacheList() {
				// if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId) return uni.$u.toast(this.$t('common.tips2'))
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId) {
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/cacheList/index?sewingId=${this.sewingId}`
				})
			},
			// 设备蓝牙打印
			toDevicePrint() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId) {
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/devicePrint/index?sewingId=${this.sewingId}`
				})
			},
			// 设备保养
			toMaintance() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId) {
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/deviceMaintenance/index?sewingId=${this.sewingId}`
				})
			},
			toProductionAim() {
				if (!storage.get('currentSewLineInfo') || !storage.get('currentSewLineInfo').sewingId) {
					plus.nativeUI.toast(`<p style=\"font-size: 28px\">${this.$t('common.tips2')}</p>`,{
						type: "richtext",
						duration: "long",
						verticalAlign: "middle"
					}
					);
					return
				}
				this.sewingId = storage.get('currentSewLineInfo').sewingId
				uni.navigateTo({
					url: `/pages/lineProductionAim/index?sewingId=${this.sewingId}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import 'index.scss';
</style>
